package zhengqc.map;

import zhengqc.hash_table.HashTable;

public class HashMap<K extends Comparable<K>, V> implements Map<K, V> {
    private HashTable<K, V> hashTable;

    public HashMap() {
        this.hashTable = new HashTable<>();
    }

    @Override
    public void put(K key, V value) {
        this.hashTable.add(key, value);
    }

    @Override
    public V remove(K key) {
        return this.hashTable.remove(key);
    }

    @Override
    public boolean containsKey(K key) {
        return this.hashTable.contains(key);
    }

    @Override
    public V get(K key) {
        return this.hashTable.get(key);
    }

    @Override
    public void set(K key, V value) {
        this.hashTable.set(key, value);
    }

    @Override
    public int getSize() {
        return this.hashTable.getSize();
    }

    @Override
    public boolean isEmpty() {
        return this.getSize() == 0;
    }
}
